import request from "@/utils/request";
import type { LoginForm,RefeshToken } from "./types";

// 获取验证码
export function getCaptcha() {
	return request({
		url: `/api/jtkj-auth/oauth/captcha`,
		method: "get",
	});
}
// 账号密码登录
export function loginByUsername(data:LoginForm) {
	return request({
		url: "/api/jtkj-auth/oauth/token",
		method: "post",
		headers: {
			'Dept-Id': "",
			'Role-Id': "",
			"Captcha_Key": data.key,
			"Captcha_Code": data.code,
			"Content-Type":"application/x-www-form-urlencoded"
		},
		data
	})
}

// 刷新token
export function refeshToken(data:RefeshToken){
	return request({
		url: '/api/jtkj-auth/oauth/token',
		method: 'post',
		headers: {
			'Dept-Id': "",
			'Role-Id': "",
			"Content-Type":"application/x-www-form-urlencoded"
		},
		data
	})
}
